$(window).scroll(
		function() {
			var aboveHeight = $('#top').outerHeight();
			// if scrolled down more than the header’s height
			if ($(window).scrollTop() > aboveHeight) {

				$('#bar').addClass('fixed').css('top', '0').next().css(
						'padding-top', '50px');

			} else {
				$('#bar').removeClass('fixed').next().css('padding-top', '0');
			}
		});